<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <style>
   
  </style>
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
    <input type="button" name="" value="complete" onclick='alert("complete : "+Img.complete +"\nreadyState : "+Img.readyState)' /> 
    <input type="button" name="" value="载入图片" onclick="addImg('img/pic2.png')" /> 

    <script type="text/javascript"> 
    var Img;
    function addImg(isrc) 
    { 
      Img = new Image(); 
      //Img.src = isrc; 
      Img.onload = function () 
      { 
        alert("complete : "+Img.complete +"\nreadyState : "+Img.readyState) 
        document.body.appendChild(Img); 
      } 
      Img.src = isrc; 
    } 






    function loadImg(src,callback){
    var img = new Image();
    var loaded = false;
    img.onload = function(){
      loaded = true;
    };
    img.src = src;//先onload再设置src，防止ie缓存不执行onload
    setTimeout(function(){
      if(loaded){
          callback && callback.call(img);
      }else{
          setTimeout(arguments.callee,100);//未加载完成就继续调用
      }
    }, 0);
  };



    </script> 
</body>
</html>